$(document).ready(function() {
	$(".log_c").on("blur", ".l_user", function() {
		var userName = $(".l_user").val();
		if (userName == null || userName == "") {
			alert("用户名不能为空");
		} else {
			$.ajax({
				"url" : "Servlet/UserServlet",
				"type" : "post",
				"data" : "opr=pwd&l_user=" + userName,
				"dataType" : "JSON",
				"success" : login
			});
			function login(data) {
				if (data[0].status == "error") {
					alert(data[0].hint);
					$(".l_user").val("");
				} else if (data[0].status == "success") {
					// 添加样式
				}
			}
		}

	});
	$(".log_c").on("click", ".log_btn", function() {
		var userName = $(".l_user").val();
		var pwd = $(".l_pwd").val();
		if (pwd == null || pwd == "") {
			alert("请输入密码");
		} else {
			$.ajax({
				"url" : "Servlet/UserServlet",
				"type" : "post",
				"data" : "opr=pwd1&l_pwd=" + pwd + "&l_user=" + userName,
				"dataType" : "JSON",
				"success" : password
			});
			function password(data) {
				if (data[0].status == "error") {
					alert(data[0].hint);
					$(".l_pwd").val("");
				} else if (data[0].status == "success") {
					window.location = "Index.jsp?name="+data[0].hint;
				}
			}
		}
	});

});